﻿using Castle.MicroKernel;
using Castle.MicroKernel.Registration;

namespace ClientOverflow.Core
{
    /// <summary>
    /// The ServicesProvider is an internal class implementing the IServicesProvider interface. The purpose
    /// of this class is to maintain instances of services in the application. The services are mapped to
    /// proper intrafces and the internal implementation is based on IoC container.
    /// </summary>
    internal class ServicesProvider : IServicesProvider
    {
        private readonly DefaultKernel kernel;

        public ServicesProvider()
        {
            kernel = new DefaultKernel();
            kernel.Register(Component.For<ILoginService>().ImplementedBy<LoginService>().LifeStyle.Singleton);
        }

        public ILoginService LoginService
        {
            get
            {
                return kernel.Resolve<ILoginService>();
            }
        }
    }
}